<!-- @FileDescription: 公共-多语言切换组件 -->
<template>
    <div>
        
        <div style="min-height:300px;">
            <div style="display:flex;vertical-align: middle;width:480px;padding:10px 20px;">
                <div style="display: inline-block;width:140px;height:40px;line-height: 40px;text-align: right;">
                    授权门禁组：
                </div>
                <div style="display:inline-block;width:400px;min-height:40px;line-height: 40px;"  class="menjiselectinput">
                    
                    <el-select v-model="authend_group_sn" style="width:300px;" filterable multiple placeholder="搜索或选择门禁组(多选)" size="small">
                        <el-option
                        v-for="item in menjinData"
                        :key="item.value"
                        :label="item.menjinzumingcheng"
                        :value="item.id">
                        </el-option>
                    </el-select>
                </div>
            </div>
            <div style="display:flex;vertical-align: middle;width:480px;padding:10px 20px;">
                <div style="display: inline-block;width:140px;min-height:40px;line-height: 40px;text-align: right;">
                    授权结束日期：
                </div>
                <div style="display:inline-block;width:400px;height:40px;line-height: 40px;"  class="menjiselectinput">
                    <el-date-picker style="width:300px;"
                        v-model="authend_time"  size="small"
                        type="date" 
                        placeholder="授权结束日期"
                        format="yyyy-MM-dd"
                        value-format="yyyy-MM-dd" 
                        >
                    </el-date-picker>
                </div>
            </div>
        </div>
        <div style="padding:20px 20px 40px 160px;">
            <el-button type="primary" @click="goDroopSubmit">确认授权门禁</el-button>
            <el-button @click="goClose">取消</el-button>
            
        </div>
    </div>
  </template>
  
  <script>
  export default {
    props: {
        menjinData: {
            type: Array,
            default: () => []
        },
        
    },
    data() {
      return {
        authend_group_sn:[],
        authend_time:'',
      }
    },
    mounted() {
        this.authend_group_sn = [];
        const now = new Date();
        const year = now.getFullYear();
        const month = now.getMonth() + 1 > 9 ? now.getMonth() + 1 : '0' + (now.getMonth() + 1); // 月份从0开始，需要加1
        const day = now.getDate() > 9 ? now.getDate() : '0' + now.getDate();
        this.authend_time = year + 10 + '-' + month + '-' + day;
    },
    methods: {
      
      goClose(){
        this.$emit("goMenjinFn", 1)
      },
      goDroopSubmit(){
        if(this.authend_group_sn.length > 0){
            let authobj = {groupSn: this.authend_group_sn, endTime: this.authend_time}
            this.$emit("goMenjinFn", 2, authobj)
        }else{
            this.$message.error("请选择授权门禁组！")
        }
      },
    }
  }
  </script>
  <style scoped>
  .icondiqiu {
    font-size: 20px;
    color: #fff;
  }
  </style>
  